1. Field of the Invention
The present invention relates to a communication apparatus having multiple communication interfaces and to a method of controlling this apparatus.
2. Description of the Related Art
A large number of electronic devices having a wireless communication function typified by a wireless LAN (referred to also as a “WLAN” below) compliant with the IEEE 802.11 series are now available for sale. Such wireless LANs have two modes, namely an infrastructure mode and an adhoc mode. In the infrastructure mode, an infrastructure network is formed by an access point (“AP” below), which manages the wireless network, and a communication terminal (a station or “STA” below), which communicates upon being connected to the wireless network. Data communication by the STA in the infrastructure network is performed via the AP at all times.
With an infrastructure network, communication with a wide-area network (“WAN” below) is possible via the AP. To accomplish this, data communication generally uses routable addresses allocated by a DHCP server within the LAN or by a DHCP server function incorporated within the AP. The term “routable address” refers to an IP address that is transferable to a router.
In the adhoc mode, on the other hand, an adhoc network is formed by a STA alone and does not require a device to manage the wireless network. Data communication in an adhoc network is carried out directly between STAs. Further, in an adhoc network, data communication generally uses link-local addresses in view of the absence of a device for managing the network. For example, 169.254.0.0 to 169.254.255.255 are being utilized as link-local addresses in IPv4.
Devices capable of operating in both the infrastructure mode and adhoc mode simultaneously have been developed in recent years. In such a device, generally the infrastructure mode and the adhoc mode are managed internally as respective separate interfaces. For this reason, control similar to that of a device physically having multiple interfaces is necessary.
In the case of a device having multiple interfaces, control is necessary for selecting from which interface to transmit data that is to be transmitted by an application. With almost all communication applications, however, control for selecting the interface is not carried out. Consequently, control for selecting the interface used in data transmission is necessary in all layers of communication layers.
Control for selecting an interface used in data communication generally employs an IP-layer routing table. Registered in the routing table on a per-route basis is an entry in which a destination IP address, gateway IP address and interface, etc., constitute one set. If a transmit request from a higher-order layer arrives in the IP layer, an entry that matches the destination IP address of the transmission data is searched for in the IP layer. If a matching entry exists in the routing table, then the interface used in data transmission is decided based upon the interface information of the entry.
In order to control a plurality of interfaces utilizing a routing table, however, appropriate settings are necessary and, since making the settings requires expert knowledge, this is a difficult task for the general user. Accordingly, a method has been proposed in which interface selection control is performed, without setting up a routing table, by adding a hierarchical layer, which is for selecting the interface to be used in communication, between a MAC layer and the IP layer (see the specification of Japanese Patent Laid-Open No. 2004-289839).
However, with conventional interface selection control using a routing table, a problem is that the interface cannot be selected appropriately in an instance where entries corresponding to identical network addresses exist. In particular, the following problem arises in a case where the infrastructure mode and adhoc mode are activated simultaneously:
In order for a terminal for which a routable address has been set to communicate with another terminal for which a link-local address has been set, an entry the destination of which is the link-local network address is registered in the routing table of this terminal. For example, in a case where an IP address 192.168.1.10 in an infrastructure mode has been set in the terminal, the following entry is registered in the routing table, by way of example;
destination IP address: 169.254.0.0/16
gateway IP address: 192.168.1.10
interface: WLAN (infrastructure mode)
According to this entry, the interface of the WLAN (infrastructure mode) is selected for data communication to destinations 169.254.0.0 to 169.254.255.255.
With an adhoc network, on the other hand, since a link-local address generally is used, the following entry is registered in the routing table in order to communicate with another terminal for which a link-local address has been set:
destination IP address: 169.254.0.0/16
gateway IP address: 169.254.11.22
interface: WLAN (adhoc mode)
According to this entry, the interface of the WLAN (adhoc mode) is selected for data communication to destinations 169.254.0.0 to 169.254.255.255.
In the setting of such routing tables, a case where the infrastructure mode or adhoc mode is used exclusively does not present a problem because only either one of the entries is registered. However, in a case where both of the entries are registered in order for both modes to be used simultaneously, two entries for which the destination IP addresses are identical will exist and, as a consequence, interface selection will no longer be performed in appropriate fashion.
Further, the method in which a layer for selecting the interface to be used in transmission is added between the MAC and IP layers necessitates a large-scale modification of the existing network stack and involves a heavy development load. Furthermore, since such a modification lacks universality, every stack used requires that a modification conforming to a respective set of specifications be performed. This is a problem since it can lead to an increase in development load.